<?php
// +---------------------------------------------------------------------+
// | OneBase    | [ WE CAN DO IT JUST THINK ]                            |
// +---------------------------------------------------------------------+
// | Licensed   | http://www.apache.org/licenses/LICENSE-2.0 )           |
// +---------------------------------------------------------------------+
// | Author     | Bigotry <3162875@qq.com>                               |
// +---------------------------------------------------------------------+
// | Repository | https://gitee.com/Bigotry/OneBase                      |
// +---------------------------------------------------------------------+

namespace app\admin\controller;

/**
 * 首页控制器
 */
class Index extends AdminBase
{
    
    /**
     * 首页方法
     */
    public function index()
    {
       // $arr='[{"gid":1,"num":1}]';
		//$str=json_decode($arr);
		//var_dump($str);exit;
        // 获取首页数据
       // $index_data = $this->logicAdminBase->getIndexData();
        $info=array();
        $info['all']=db('user')->count();
        $info['ball']=db('user')->where('is_service',1)->count();
		$info['sc']=db('user')->where('`is`=1')->count();
        $info['call']=db('user')->where('grade !=0 ')->count();
        $info['dj']=db('user')->where('status=0')->count();
		//$sums=db('moneyyj')->field('sum(money) as sum')->where(" type IN(1,2,3,6)")->find();
        //$info['sums']=$sums['sum'];
        $info['now']=db('user')->where("date_format(from_unixtime(create_time),'%Y-%m-%d') = date_format(now(),'%Y-%m-%d')")->count();
        $sum=db('user')->field('sum(moneyMy) as sum')->find();
        $info['sum']=$sum['sum'];
        $jfsum=db('user')->field('sum(count) as sum')->find();
        $info['jfsum']=$jfsum['sum'];
        $xfqsum=db('user')->field('sum(xfq) as sum')->find();
        $info['xfqsum']=$xfqsum['sum'];
        $txsum=db('moneyapp')->field('sum(money) as sum')->find();
        $info['txsum']=$txsum['sum'];
        $txsums=db('moneyapp')->field('sum(money) as sum')->where('stat',1)->find();
        $info['txsums']=$txsums['sum'];
        $nowsum=db('moneyapp')->field('sum(money) as sum')->where("date_format(from_unixtime(create_time),'%Y-%m-%d') = date_format(now(),'%Y-%m-%d')")->find();
        $info['nowsum']=$nowsum['sum'];
        $this->assign('info', $info);
        return $this->fetch('index');
    }
}
